import {defineStore} from 'pinia'

export const useRequestStore = defineStore('request-store', {
  state: () => {
    return {
      httpRequestList: []
    }
  },
  getters: {},
  actions: {
    setHttpRequestList(payload) {
      if (payload === 'all') {
        // 添加标识，中断请求
        this.httpRequestList.length > 0 ? this.httpRequestList.forEach(item => item('suspend')) : ''
        this.httpRequestList = []
      } else {
        payload && this.httpRequestList.push(payload)
      }
    }
  }
})
